const getFullAreaCodeArr = areaCode => {
  if (getPrototypeOf(areaCode) != 'String' && areaCode.length != 12) {
    console.log('areaCode错误!')
    return areaCode
  }
  let arr = [],
    levelCode = ''
  if (areaCode.slice(0, 1) == '0') {
    //国家
    levelCode = 0
  } else if (areaCode.slice(2, 12) == '0000000000') {
    //省
    levelCode = 1
  } else if (areaCode.slice(4, 12) == '00000000') {
    // 市
    levelCode = 2
  } else if (areaCode.slice(6, 12) == '000000') {
    // 县
    levelCode = 3
  } else if (areaCode.slice(9, 12) == '000') {
    // 镇级
    levelCode = 4
  } else {
    // 村级
    levelCode = 5
  }
  arr[0] = '000000000000'
  arr[1] = areaCode.slice(0, 2).padEnd(12, '0')
  arr[2] = areaCode.slice(0, 4).padEnd(12, '0')
  arr[3] = areaCode.slice(0, 6).padEnd(12, '0')
  arr[4] = areaCode.slice(0, 9).padEnd(12, '0')
  arr[5] = areaCode
  arr = arr.slice(0, levelCode + 1)
  return arr
}
const getPrototypeOf = data => {
  let type = Object.prototype.toString.call(data)
  if (type === '[object String]') {
    type = 'String'
  } else if (type === '[object Number]') {
    type = 'Number'
  } else if (type === '[object Null]') {
    type = 'Null'
  } else if (type === '[object Boolean]') {
    type = 'Boolean'
  } else if (type === '[object Array]') {
    type = 'Array'
  } else if (type === '[object Object]') {
    type = 'Object'
  } else {
    type = '未进行判断的类型:' + type
  }
  return type
}
export default getFullAreaCodeArr
